/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ipark.sistemski;
import java.sql.*;

/**
 *
 * @author Damjan Vantur
 */
public class DBConnect {

    private static Statement stat;
    private static Connection conn;
    
    static {
                
            try {
                     // Drajver :P
                        Class.forName("com.mysql.jdbc.Driver");
                        
                        // URL za povezavo
                        String url = "jdbc:mysql://localhost/ipark";
                        
                        // Se povezemo...
                        conn = DriverManager.getConnection(url, "root", "");
                        
                        // Primerek razreda statement
                        stat = conn.createStatement();
            
            } catch(Exception e) { System.out.println(e); }
                
        }

    public static Statement statement() { return DBConnect.stat; }
    public static Connection connection() { return DBConnect.conn; }
    
    /* Close connection */
    public static void close() {
    
        try {
                conn.close();
        } catch(Exception e) { }
        
    }

}

    

